using System.Collections.Generic;
using System.Data;

namespace DbManager.QueryBuilder.DataManagment
{
    class DataTableComparer : IEqualityComparer<DataRow>
    {
        private readonly string _columnHeader;

        public DataTableComparer(string columnHeader)
        {
            _columnHeader = columnHeader;
        }

        public bool Equals(DataRow x, DataRow y)
        {
            return x.Field<string>(_columnHeader) == y.Field<string>(_columnHeader);
        }

        public int GetHashCode(DataRow obj)
        {
            return obj.ToString().GetHashCode();
        }
    }
}